//
//  YMSBaseNavController.swift
//  YMSWeibo
//
//  Created by 杨茂盛 on 2016/11/12.
//  Copyright © 2016年 杨茂盛. All rights reserved.
//

import UIKit

class YMSBaseNavController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if self.childViewControllers.count>0 {
            viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "返回", imageName: "navigationbar_back_withtext", target: self, action: #selector(clickBtn))
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
    
    //左边按钮的监听方法
    @objc private func clickBtn(){
        popViewController(animated: true)
    }
    
}
